﻿﻿/* =====================================================================================================================
  * Author - Sachin Sharma
  * Copyright (c) 2012 Sachin Sharma (3screator.com). All rights reserved.
  * Follows most coding rules. However, due to time constraint you will see some hard coding or rules not strictly followed
=====================================================================================================================*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
using Windows.UI.Xaml;

namespace SpellCheckeCS
{
    public class SpellCheckerSupportedLangs
    {
        public string LangTag { get; set; }
    }

    public class SpellCheckerViewModel
    {
        public List<SpellCheckerSupportedLangs> LanguageTags { get; set; }
        
        public int SupportedLangCount 
        {
            get
            {
                int count = 0;
                if (LanguageTags != null)
                    count = LanguageTags.Count;
                return count;
            }
        }

        public Visibility SpellingResultsAvailable 
        {
            get
            {
                if (SpellCheckingResults != null)
                    return Visibility.Collapsed;
                return Visibility.Visible;
            }
        }
        

        public Visibility SpellingCorrect 
        {
            get
            {
                if (SpellCheckingResults != null)
                    return (SpellCheckingResults.IsCorrect == true ? Visibility.Visible : Visibility.Collapsed);
                return Visibility.Collapsed;
            }
        }

        public Visibility SpellingInCorrect 
        {
            get
            {
                if (SpellCheckingResults != null)
                    return (SpellCheckingResults.IsCorrect == false ? Visibility.Visible : Visibility.Collapsed);
                return Visibility.Collapsed;
            }
        }

        public IList<string> Suggestions 
        {
            get
            {
                IList<string> lstSuggestons = new List<string>();
                if (SpellCheckingResults != null)
                    lstSuggestons = SpellCheckingResults.Suggestions;
                return lstSuggestons;
            }
        }

        public string ReplacementIfAny 
        {
            get
            {
                string replacement = string.Empty;
                if (SpellCheckingResults != null)
                    replacement = SpellCheckingResults.ReplacementIfAny;
                return replacement;
            }
        }   
            
        public SpellCheckerWrapperComponent.SpellingCheckResults  SpellCheckingResults { get; set; } 
    }
}
